#include "expdaily.h"
#include "ui_expdaily.h"
#include<QDesktopWidget>
#include<QDebug>
//This show dateedit widget to select a date to view its report against categories
ExpDaily::ExpDaily(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::ExpDaily)
{
    ui->setupUi(this);
    QRect in=QApplication::desktop()->availableGeometry(this);
    ui->scrollArea->setGeometry(0,0,(in.width()),(in.height()));
    ui->dateEdit->setFocus();
    ui->verticalLayout->addSpacing(15);
    ui->verticalLayout->setStretch(0,0);
    ui->verticalLayout->setStretch(1,5);
    //ui->verticalLayout->setStretch(2,50);
   // ui->verticalLayout->setStretch(3,50);
    int fontSize=10;
    ui->label_header->setFont(QFont("lucida",fontSize,QFont::Normal,FALSE));
    //ui->label_year->setFont(QFont("lucida",(fontSize-2),QFont::Normal,FALSE));
    ui->dateEdit->setFont(QFont("lucida",(fontSize-2),QFont::Normal,FALSE));
    ui->pushButton->setFont(QFont("lucida",(fontSize-2),QFont::Normal,FALSE));
    QAction* backAction = new QAction( tr("Back"), this );
    backAction->setSoftKeyRole( QAction::NegativeSoftKey );
    connect(backAction, SIGNAL(triggered()), this, SLOT(back()));
    addAction( backAction );

    ui->dateEdit->setDate(QDate::currentDate());//Set current date
}

ExpDaily::~ExpDaily()
{
    delete ui;
}
void ExpDaily::back()
{
    (new Reports)->show();
}

void ExpDaily::on_pushButton_clicked()
{
   (new GraphDaily(ui->dateEdit->date()))->show();
}
